package com.pi.base.service;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.pi.base.common.BasePage;
import com.pi.base.common.BaseResult;
import com.pi.base.entity.SysGroup;
import com.pi.base.entity.SysMenu;
import com.pi.base.entity.SysUser;
import com.pi.base.vo.SysGroupVO;

public interface ISysUserService {
	
	/**
	 * 用户登录
	 * @param userName
	 * @param password
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	public BaseResult checkLogin(String userName,String password,HttpServletRequest request,HttpServletResponse response) throws Exception;
	
	/**
	 * 查询全部菜单
	 * @param roleId
	 * @param level
	 * @return
	 * @throws Exception
	 */
	public List<SysMenu> getAllMenuByRoleIdAndLevel(Integer roleId, Integer... level) throws Exception;
	
	/**
	 * 修改用户密码
	 * @param userId
	 * @param newPwd
	 * @return
	 * @throws Exception
	 */
	public boolean updateUserPwd(SysUser loginUser) throws Exception;
	
	/**
	 * 查询多级分组信息
	 * @param groupId
	 * @return
	 * @throws Exception
	 */
	public List<SysGroup> getGroupWithSubListByGroupId(String groupId) throws Exception;
	
	/**
	 * 查询多级分组信息
	 * @param groupId
	 * @return
	 * @throws Exception
	 */
	public List<SysGroupVO> getGroupWithSubListByGroupId2(String groupId) throws Exception;
	
	/**
	 * 用户列表
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public BasePage<SysUser> listSysUserByGroupID(Map<String,Object> params,int groupId,boolean superState) throws Exception;
	
	/**
	 * 用户详情
	 * @param userId
	 * @return
	 * @throws Exception
	 */
	public SysUser sysUserInfoById(int userId)  throws Exception;
	
	/**
	 * 验证用户名是否重复
	 * @param userName
	 * @param userId
	 * @return
	 * @throws Exception
	 */
	public boolean existSysUserName(SysUser searchUser) throws Exception;
	
	/**
	 * 新增系统用户
	 * @param insertUser
	 * @return
	 * @throws Exception
	 */
	public BaseResult insertSysUser(SysUser insertUser) throws Exception;
	
	/**
	 * 修改用户信息
	 * @param updateUser
	 * @return
	 * @throws Exception
	 */
	public void updateSysUser(SysUser updateUser) throws Exception;
	
	/**
	 * 批量删除用户
	 * @param userIdList
	 * @throws Exception
	 */
	public void deleteSysUsers(List<Integer> userIdList) throws Exception; 
	
	/**
	 * 修改用户角色
	 * @param userIdList
	 * @param roleId
	 * @param roleName
	 * @throws Exception
	 */
	public void userRoleSetByUserIdsAndRoleIdAndName(List<Integer> userIdList, Integer roleId,String roleName) throws Exception;
	
	/**
	 * 批量修改用户分组
	 * @param userIdList
	 * @param setGroupId
	 * @param setGroupName
	 * @throws Exception
	 */
	public BaseResult userGroupSetByUserIdsAndGroupId(List<Integer> userIdList, Integer groupId) throws Exception;

	/**
	 * 密码重置
	 * @param userIdList
	 * @param newPassword
	 * @throws Exception
	 */
	public void userPasswordResetByUserIds(List<Integer> userIdList, String newPassword)  throws Exception;
	
	/**
	 * 状态修改
	 * @param userIdList
	 * @param newPassword
	 * @throws Exception
	 */
	public void userStateSetByUserIds(List<Integer> userIdList, int userState)  throws Exception;
	
	public List<SysUser> listSysUserByIds(List<Integer> userIdList)  throws Exception;
	/**
	 * @description 根据账号修改用户信息
	 * @param user 用户信息包装类
	 * @return
	 * @throws SQLException
	 */
	public boolean updateUserInfo(SysUser appUser) throws SQLException;
}
